# -*- coding:utf-8 -*-
import csv


from handle.handle_path import DATADIR

"""
    处理用户数据
"""

def handerUserData():
    """
    处理用户的csv
    :return:
    """
    userdict = dict()
    with open(DATADIR+"/userdata.csv") as file:
        reader = csv.reader(file, delimiter=',', quotechar=',', quoting=csv.QUOTE_MINIMAL)
        for line in reader:
            userdict[line[0]] = line[1]
    return userdict

def handerLogin():
    """
    处理用户的csv
    :return:
    """
    userdict = dict()
    with open(DATADIR+"/login.csv") as file:
        reader = csv.reader(file, delimiter=',', quotechar=',', quoting=csv.QUOTE_MINIMAL)
        for line in reader:
            userdict[line[0]] = line[1]
    return userdict

def handerCreateProjectData():
    """
    处理创建项目的csv
    :return:
    """
    userdict = dict()
    with open(DATADIR+"/create_project_data.csv") as file:
        reader = csv.reader(file, delimiter=',', quotechar=',', quoting=csv.QUOTE_MINIMAL)
        for line in reader:
            userdict[line[0]] = line[1]
    return userdict

def handleAttendanceManageData():
    """
    处理创建项目的csv
    :return:
    """
    lis = list()
    with open(DATADIR+"/attendance_case_data.csv") as file:
        reader = csv.reader(file, delimiter=',', quotechar=',', quoting=csv.QUOTE_MINIMAL)
        for line in reader:
            lis.append(line)
    return lis


if __name__ == "__main__":
    print(handerLogin())